#include("../../comm/ListHead.html")
<div class="layui-fluid">
    <div class="layui-row layui-col-space5">
        <div class="layui-col-md2 width-15">
            <div class="layui-card height-auto">
                <div id="tree_1" class="demo-tree demo-tree-box"></div>
            </div>
        </div>
        <div class="layui-col-md10 width-85">
            <div class="layui-card height-auto" id="codes">
                <div class="layui-card-header SearchTable">
                    当前位置：<span id="detail_name_str" class="color_green">代码示例</span>
                </div>
                <div class="layui-card-body">
<pre class="layui-code" lay-title="测试" lay-height="" lay-skin="" lay-encode="" about="false">
//代码区域
var a = 'hello layui';
</pre>

                </div>
            </div>
        </div>
    </div>
</div>
<script language="JavaScript">
    var USER_JWT = "";
    var index = 0;
    var admin;
    var table, tableindex;

    layui.use(['table', 'form', 'tree', 'code'], function () {
        admin = layui.admin, table = layui.table, form = layui.form, tree = layui.tree;
        //树数据
        treedata = [{
                        "checked": false,
                        "children": [
                            {
                                "id": "table", "spread": false, "title": "<span style=\"color:#67C23A\">通用</span>", "turn": false, "datas": {}, "children": [
                                {"id": "Color", "title": "文字颜色", "turn": true},
                            ]
                            },
                            {
                                "id": "table", "spread": false, "title": "表格示例", "turn": false, "datas": {}, "children": [
                                {"id": "Button", "title": "按钮", "turn": true},
                                {"id": "AdvSearch", "title": "高级搜索", "turn": true},
                                {"id": "AddEditDel", "title": "增删改", "turn": true},
                                {"id": "CommCode", "title": "常用代码", "turn": true},
                                {"id": "TableSwitch", "title": "switch", "turn": true},
                            ]
                            },
                            {
                                "id": "table", "spread": false, "title": "表单示例", "turn": false, "datas": {}, "children": [
                                {"id": "FormMoreAuto", "title": "常用代码", "turn": true},
                                {"id": "FormMoreColl", "title": "一行多列", "turn": true},
                                {"id": "FormMoreSelect", "title": "表单多选", "turn": true},
                                {"id": "FormCheckbox", "title": "发布按钮", "turn": true},
                                {"id": "FormUpload", "title": "上传|数|图|颜", "turn": true}
                            ]
                            },
                            {
                                "id": "event", "spread": false, "title": "行为事件", "turn": false, "datas": {}, "children": [
                                {"id": "EvevtObject", "title": "给对象添加事件", "turn": true},
                            ]
                            },
                            {
                                "id": "java", "spread": false, "title": "JAVA示例", "turn": false, "datas": {}, "children": [
                                {"id": "UploadImage", "title": "上传图片", "turn": true},
                            ]
                            },
                            {
                                "id": "java", "spread": false, "title": "二维码", "turn": false, "datas": {}, "children": [
                                {"id": "QCode", "title": "二维码", "turn": true},
                            ]
                            }
                        ], "datas": {}, "disabled": false, "id": "base", "spread": true, "title": "示例代码"
                    }];


        //树渲染
        tree.render({
            elem: '#tree_1', data: treedata, showCheckbox: false, id: 'demoId1', isJump: true, jsOpen: true
            , click: function (obj) {
                var data = obj.data;
                if (data.turn) {
                    layui.$.ajax({
                        type: 'POST',
                        url: 'TestCodeDataApi',
                        async: false,
                        data: {codes: data.id},
                        success: function (results) {
                            codes.innerHTML = results;
                            layui.code({about: false});
                        },
                        error: function (return_data) {
                            alert(return_data);
                        }
                    });
                }
            }
        });
    });
</script>
#include("../../comm/Foot.html")